﻿using System;
using System.Linq;
using System.Text;
using Crossroad.Utils.Extensions;
using SqlSugar;

namespace Crossroad.OAuth.Model
{
    ///<summary>
    ///oauth2.0刷新令牌表
    ///</summary>
    [SugarTable("oauth_refresh_tokens")]
    public partial class RefreshToken : ModelContext
    {
        public RefreshToken()
        {
        }

        /// <summary>
        /// Desc:刷新令牌
        /// Default:
        /// Nullable:False
        /// </summary>           
        [SugarColumn(IsPrimaryKey = true, ColumnName = "refresh_token")]
        public string refreshToken { get; set; }

        /// <summary>
        /// Desc:权限范围
        /// Default:
        /// Nullable:True
        /// </summary>           
        public string scope { get; set; }

        /// <summary>
        /// Desc:用户id
        /// Default:
        /// Nullable:True
        /// </summary>           
        [SugarColumn(ColumnName = "user_id")]
        public string userId { get; set; }

        /// <summary>
        /// Desc:客户端id
        /// Default:
        /// Nullable:False
        /// </summary>           
        [SugarColumn(ColumnName = "client_id")]
        public string clientId { get; set; }

        /// <summary>
        /// Desc:有效期
        /// Default:
        /// Nullable:False
        /// </summary>           
        public int expires { get; set; }

        #region 扩展字段

        /// <summary>
        /// 有效期
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string expiresText => expires.ToDateTimeStr();

        #endregion


    }
}
